﻿// JScript 文件

//chenl
//style 0 表示虚线，1表示实线
//color 线颜色

function MakeADiv(entType, ID, strVml)
{
    var vDivLin = document.createElement("div");
    vDivLin.style.left = 0 + "px";
    vDivLin.style.top = 0 + "px";
    vDivLin.entType = entType;
    vDivLin.DevID   = ID;
    vDivLin.id = ID;
	vDivLin.innerHTML = strVml;
	return vDivLin
}

   
function makeLinStr(id, color, left, top, x0, y0, x1, y1, style)
{
    var vScriptLin;
    if (style == 0)
    {
	     vScriptLin = "<v:line id = '" + id + "'style='Z-INDEX:5;LEFT:"+left + "px; POSITION:absolute;TOP:"+ top + "px' from='"+ x0 + "," + y0 +"' to='" + x1 + ","+y1 + "'strokecolor='"+ color+"'>" + "\n<v:Stroke dashstyle='shortdot'/>" + '</v:line>';
	}
	else
	{
	     vScriptLin ="<v:line id = '" + id + "'style='Z-INDEX:5;LEFT:"+left + "px; POSITION:absolute;TOP:"+ top + "px' from='"+ x0 + "," + y0 +"' to='" + x1 + ","+y1 + "'strokecolor='"+ color+"'/>"
	}
	
	return vScriptLin;
}

//chenl
//fillcolor 0 表示不填充，填充则用颜色
//lincolor 圈的颜色
function makeCirStr(id, fillcolor, lincolor, x0, y0, rad, str, type)
{
    var vScriptCir;
    if (fillcolor == 0) //圆圈 
    {
        vScriptCir = "<v:oval id='" + id + "'" + " strokecolor = '" + lincolor + "'" +" style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px' title='"+str+"'><span id='span" + id + "' style='visibility:hidden;position:absolute;left:" + rad*9/10 + "px;top:" + rad*9/10 + "px;'><b>" + str + "</b></span></v:oval>";
        //vScriptCir += "<span id='span" + id + "' style='visibility:hidden;Z-INDEX:12;position:absolute;left:" + (x0-rad) + "px;top:" + (y0-rad) + "px;'>" + str + "</span>";
    }
    else    //画填充，缆线占用
    {
        //vScriptCir = "<v:oval id='"+ id + "'" + " fillcolor ='" + fillcolor + "'" + " strokecolor= '" + lincolor + "'"+ " style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px' title='"+str+"'><span id='span" + id + "' style='visibility:hidden;position:absolute;left:" + rad*9/10 + "px;top:" + rad*9/10 + "px;'><b>" + str + "</b></span></v:oval>";
        vScriptCir = "<v:oval id='"+ id + "'" + " fillcolor ='" + fillcolor + "'" + " strokecolor= '" + lincolor + "'"+ " style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px' title='"+str+"'></v:oval>";
    }

	return vScriptCir;
}

function makeCodeStr(id, x0, y0, rad, str)
{
    var vScriptCir;
    vScriptCir = "<v:Textbox id='" + id + "'" + " style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;'>" + str + "</v:Textbox>";
	return vScriptCir;
}

//赵坤
function makeCirStrDG(id, fillcolor, lincolor, x0, y0, rad, str, type)
{
    var vScriptCir;
    if (fillcolor == 0) //圆圈 
    {
        vScriptCir = "<v:oval filled='t' fillcolor ='white' id='" + id + "'" + " strokecolor = '" + lincolor + "'" +" style='position:absolute;Z-INDEX:1;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px' title='"+str+"' /><v:fill opacity='.1'/ ></v:Oval>";
    }
    return vScriptCir;
}
//add画线是Z-INDEX:3002
function makePntLinStr(id, color, left, top, x0, y0, x1, y1, style)
{
    var vScriptLin;
    if (style == 0)
    {
	     vScriptLin = '<v:line id = "' + id + '"' +  'style="Z-INDEX:3002;LEFT:' + left + 'px;POSITION:absolute;TOP:'+ top + 'px" from="'+ x0 + ',' + y0 +'" to="' + x1 + ','+y1 + '"strokecolor="'+ color+'">' + '\n<v:Stroke dashstyle="shortdot"/>' + '</v:line>';
	}
	else
	{
	     vScriptLin = '<v:line id = "' + id + '"' +  'style="Z-INDEX:3002;LEFT:' + left + 'px;POSITION:absolute;TOP:'+ top + 'px" from="'+ x0 + ',' + y0 +'" to="' + x1 + ','+y1 + '"strokecolor="'+ color+'"/>'
	}
	
	return vScriptLin;
}
//add画小管道占用管道Z-Index=3001
function makePntCirStr(id, fillcolor, lincolor, x0, y0, rad, str, type)
{
    var vScriptCir;
    if (fillcolor == 0) //圆圈 
    {
        vScriptCir = "<v:oval id='" + id + "'" + " strokecolor = '" + lincolor + "'" +" style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px; z-index:3001' title='"+str+"'/>";
    }
    else    //画填充，缆线占用
    {
        vScriptCir = "<v:oval id='"+ id + "'" + " fillcolor ='" + fillcolor + "'" + " strokecolor= '" + lincolor + "'"+ " style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px; z-index:3001' title='"+str+"'/>";
    }

	return vScriptCir;
}


//add画电缆接连接点Z-Index=3000
function makeDljljdCirStr(id, lincolor, x0, y0, rad)
{
    var vScriptCir;
   //圆圈 
    vScriptCir = "<v:oval filled='t' fillcolor ='white' id='" + id + "'" + " strokecolor = '" + lincolor + "'" +" style='position:absolute;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;width:"+rad*2+"px;height:" +rad*2+"px; z-index:3000'><v:fill opacity='.1'/></v:Oval>";
	return vScriptCir;
}



function dispqmqs(x0,y0,rad,strbm)
{
    var vvml;
    
    //画圆
    vvml = "<v:Oval filled='t' fillcolor ='white' strokecolor='red' strokeweight='1' style='position:absolute;z-index:3003;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;WIDTH:"+rad*2+"px;HEIGHT:"+rad*2+"px' title='"+strbm+"'><v:fill opacity='.1'/></v:Oval>";
    //画圆内平行的一条直径
    vvml += "<v:line strokecolor='red' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+(x0-rad)+","+y0+"' to='"+(x0+rad)+","+y0+"'/>";
    //外切于圆的正方形内左下角的一个小红叉
    vvml += "<v:line strokecolor='red' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+(x0-rad)+","+(y0+rad)+"' to='"+(x0-rad+0.29*rad)+","+(y0+rad-0.29*rad)+"'/>";
    vvml += "<v:line strokecolor='red' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+(x0-rad)+","+(y0+rad-0.29*rad)+"' to='"+(x0-rad+0.29*rad)+","+(y0+rad)+"'/>";
    //外切于圆的正方形内右上角的一个小红叉
    vvml += "<v:line strokecolor='red' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+(x0+rad)+","+(y0-rad)+"' to='"+(x0+rad-0.29*rad)+","+(y0-rad+0.29*rad)+"'/>";
    vvml += "<v:line strokecolor='red' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+(x0+rad-0.29*rad)+","+(y0-rad)+"' to='"+(x0+rad)+","+(y0-rad+0.29*rad)+"'/>";

    return vvml;
}

//3003
function dispcgq(x0,y0,rad,strbm)
{
    var vvml;

    //以TeCgq.Rad为直径在正中画一个圆
    vvml = "<v:Oval filled='t' fillcolor ='white' strokecolor='red' strokeweight='1' style='position:absolute;Z-INDEX:3003;left:"+(x0-rad/2)+"px;top:"+(y0-rad)+"px;WIDTH:"+rad+"px;HEIGHT:"+rad+"px' title='"+strbm+"'><v:fill opacity='.1'/></v:Oval>";
    //圆里写上字母"G"
    //vvml += "<v:line style='Z-INDEX:4;LEFT:"+(x0-rad)+"; POSITION:absolute; TOP:"+(y0-rad*2)+"'; to='180,1pt'; strokecolor='Red'><v:path textpathok='t'/><v:textpath style='FONT-SIZE:80;FONT-FAMILY:宋体'; on='t'; string='G'/></v:line>"
    //vvml += "<span style='FONT-WEIGHT:bolder;FONT-SIZE:"+rad+";Z-INDEX:2;LEFT:"+(x0-rad)+";TOP:"+(y0-rad*2)+";COLOR:red;FONT-FAMILY:宋体;POSITION:absolute;'>G</span>";
    //在圆下正中画一条直线,长度为TeCgq.Rad
    vvml += "<v:line strokecolor='red' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+x0+","+y0+"' to='"+x0+","+(y0+rad)+"'/>";

    return vvml;
}


//type:21电缆段
//type:31光缆段  3003
function disppl(type,x0,y0,rad,strbm)
{
    var vvml;
    var color;

    if (type == 21)
    {
        color = "red";
    }
    else if (type == 31)
    {
        color = "violet";
    }
    
    //画圆内平行的一条直径
    vvml = "<v:line strokecolor='"+color+"' strokeweight='1' style='Z-INDEX:3003;POSITION:absolute' from='"+(x0-rad)+","+y0+"' to='"+(x0+rad)+","+y0+"' title='"+strbm+"'/>";
    //画两个椭圆,椭圆的顶点为TePl的圆心,并且以上面画的直线对称.
    //椭圆宽为TePl.Rad/3, 高为TePl.Rad
    vvml += "<v:Oval filled='t' fillcolor ='white' strokecolor='"+color+"' strokeweight='1' style='position:absolute;z-index:3003;left:"+(x0-rad/6)+"px;top:"+(y0-rad)+"px;WIDTH:"+(rad/3)+"px;HEIGHT:"+rad+"px' title='"+strbm+"'><v:fill opacity='.1'/></v:Oval>";
    vvml += "<v:Oval filled='t' fillcolor ='white' strokecolor='"+color+"' strokeweight='1' style='position:absolute;z-index:3003;left:"+(x0-rad/6)+"px;top:"+y0+"px;WIDTH:"+(rad/3)+"px;HEIGHT:"+rad+"px' title='"+strbm+"'><v:fill opacity='.1'/></v:Oval>";

    return vvml;
}


function dispyl(type,x0,y0,rad,strbm)
{
    var vvml;
    var color;

    if (type == 21)
    {
        color = "red";
    }
    else if (type == 31)
    {
        color = "violet";
    }

    //画一个填充小圆(小圆半径为2px),颜色根据电缆光缆不同,位于顶端
    vvml = "<v:Oval filled='t' fillcolor ='white' fillcolor='"+color+"' strokecolor='"+color+"' strokeweight='1' style='position:absolute;z-index:2;left:"+x0+"px;top:"+(y0-rad)+"px;WIDTH:4px;HEIGHT:4px' title='"+strbm+"'><v:fill opacity='.1'/></v:Oval>";
    //画一条穿过TeYl中心的直线,长度为Rad + Rad*2/3
    vvml += "<v:line strokecolor='"+color+"' strokeweight='1' style='Z-INDEX:2;POSITION:absolute' from='"+x0+","+(y0-rad)+"' to='"+x0+","+(y0+rad*2/3)+"' title='"+strbm+"'/>";
    //画一个叉,叉的交点为上面画的那条直线的终点
    vvml += "<v:line strokecolor='"+color+"' strokeweight='1' style='Z-INDEX:2;POSITION:absolute' from='"+(x0-rad/3)+","+(y0+rad)+"' to='"+(x0+rad/3)+","+(y0+rad/3)+"' title='"+strbm+"'/>";
    vvml += "<v:line strokecolor='"+color+"' strokeweight='1' style='Z-INDEX:2;POSITION:absolute' from='"+(x0-rad/3)+","+(y0+rad/3)+"' to='"+(x0+rad/3)+","+(y0+rad)+"' title='"+strbm+"'/>";

    return vvml;
}


function dispjt(type,x0,y0,rad,strbm)
{
    var vvml;
    var color;

    if (type == 20)
    {
        color = "red";
    }
    else if (type == 30)
    {
        color = "violet";
    }

    //画一个填充圆,颜色根据电缆光缆不同
    vvml = "<v:Oval filled='t' fillcolor='"+color+"' strokecolor='"+color+"' strokeweight='1' style='position:absolute;z-index:2;left:"+(x0-rad)+"px;top:"+(y0-rad)+"px;WIDTH:"+rad*2+"px;HEIGHT:"+rad*2+"px' title='"+strbm+"'><v:fill opacity='.1'/></v:Oval>";

    return vvml;
}

